var $ = layui.jquery;
/**
 * 封装请求方法
 *  url  接口请求地址
 *  data 接口请求参数（无需请求方式参数，则此项可以为空，否则必须传）
 *  para 请求方式参数（可以为空）
 *  callback 回调函数
 */
function $_request(url, data, callback, para) {
  $.ajax({
    url: APP_URL + url,
    type: para && para.type || 'POST',
    dataType: para && para.dataType || 'JSON',
    data: JSON.stringify(data),
    beforeSend: function () {
       showloading(true);
    },
    success: function (res) {
      callback(res);
     showloading(false);
    },
    error: function (res) {
    if(res.statusText == 'Unauthorized'){
        //登陆过期
        if (url.indexOf('experts')>=0){
            top.location.href= APP_URL+"/experts/login";
        }else{
            top.location.href="/relogin";
        }

    }
      console.log(res);
        showloading(false)
    },
    headers: {
      "X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr('content'),
    }
  });
}

//URL 跳转
function skipurl(url) {
  if (url.indexOf("?") > -1) {
    return url + "&v=" + Math.random();
  } else {
    return url + "?v=" + Math.random();
  }
}

//table列表鼠标悬浮提示
function tdTitle() {
  $('th').each(function (index, element) {
    $(element).attr('title', $(element).text());
  });
  $('td').each(function (index, element) {
    $(element).attr('title', $(element).text());
  });
};
function getTeacherList(data, callback, params){ return $_request('/backend/systems/gettecherlist', data, callback, params) }//获取教师列表

//消息数目

function getRoleList(data, callback, params) { return $_request('/backend/systems/roles/list', data, callback, params) }//角色列表

function addRole(data, callback, params) { return $_request('/backend/systems/roles/add', data, callback, params) }//角色新增
function editRole(data, callback, params) { return $_request('/backend/systems/roles/edit', data, callback, params) }//角色修改

function getPowerTree(data, callback, params) { return $_request('/systems/roles/powertree', data, callback, params) }//获取权限树
function getRolePowers(data, callback, params) { return $_request('/backend/systems/roles/rolepowers', data, callback, params) }//获取角色权限
function setRolePowers(data, callback, params) { return $_request('/backend/systems/roles/setrolepowers', data, callback, params) }//获取角色权限
function setRoleStatus(data, callback, params) { return $_request('/backend/systems/roles/setrolestatus', data, callback, params) }//开启/禁用角色
function getUserList(data, callback, params) { return $_request('/backend/systems/users/list', data, callback, params) }//用户列表
function editUserInfo(data, callback, params) { return $_request('/backend/systems/users/editUserInfo', data, callback, params) }//用户列表

function getAllRoles(data, callback, params) { return $_request('/backend/systems/users/getallrole', data, callback, params) }//获取所有角色
function setUserRole(data, callback, params) { return $_request('/backend/systems/users/setuserrole', data, callback, params) }//设置用户角色
function setUserStatus(data, callback, params) { return $_request('/backend/systems/users/setuserstatus', data, callback, params) }//启用/禁用用户
function getLogList(data, callback, params) { return $_request('/backend/systems/logs/list', data, callback, params) }//日志列表
function initAdminPower(data, callback, params) { return $_request('/backend/systems/roles/initAdminPower', data, callback, params) }//初始化管理员权限

//PC学生端
function getCarouselsForPcStudent(data, callback, params){ return $_request('/student/getallcarousels', data, callback, params) }
function getDicItemsByNameForPcStudent(data, callback, params){ return $_request('/student/getdicitemsbyname', data, callback, params) }
function getActivitiesForPcStudent(data, callback, params){ return $_request('/student/getActivities', data, callback, params) }
function getActivityDetailForPcStudent(data, callback, params){ return $_request('/student/getActivityDetailForPcStudent', data, callback, params) }
function applyActivityForPcStudent(data, callback, params){ return $_request('/student/applyActivityForPcStudent', data, callback, params) }
function getActivityExtendInfoForPcStudent(data, callback, params){ return $_request('/student/getActivityExtendInfoForPcStudent', data, callback, params) }
function getTeamParticipantForPcStudent(data, callback, params){ return $_request('/student/getTeamParticipantForPcStudent', data, callback, params) }
function queryStudentsForPcStudent(data, callback, params){ return $_request('/student/queryStudentsForPcStudent', data, callback, params) }
function getEndActivityDetailForPcStudent(data, callback, params){ return $_request('/student/getEndActivityDetailForPcStudent', data, callback, params) }
function editUserInfoForStudent(data, callback, params){ return $_request('/student/editUserInfoForStudent', data, callback, params) }
function getLastFiveYearsForPcStudent(data, callback, params) { return $_request('/student/myActivity/getLastFiveYearsData', data, callback, params) }//获取最近5年
function getMyActivitiesForPcStudent(data, callback, params) { return $_request('/student/myActivity/getMyActivities', data, callback, params) }//获取我参与的活动
function getMyActivityDetailForPcStudent(data, callback, params) { return $_request('/student/myActivity/getMyActivityDetailForPcStudent', data, callback, params) }//获取我参与的活动详情
function getMyJoinActivitiesForPcStudent(data, callback, params) { return $_request('/student/myActivity/getMyJoinActivitiesForPcStudent', data, callback, params) }//获取我的活动
function submitEntryForPcStudent(data, callback, params) { return $_request('/student/myActivity/submitEntryForPcStudent', data, callback, params) }//上传作品
function getUploadProductDetailForPcStudent(data, callback, params) { return $_request('/student/myActivity/getUploadProductDetailForPcStudent', data, callback, params) }//获取上传作品详细
function getMyFavoritesForPcStudent(data, callback, params) { return $_request('/student/myFavorite/getMyFavorites', data, callback, params) }//获取我收藏的活动
function doMyFavoriteForPcStudent(data, callback, params) { return $_request('/student/myFavorite/doMyFavorite', data, callback, params) }//点击收藏、取消收藏

// 轮播图
function getCarousels(data, callback, params){ return $_request('/backend/carousels/getall', data, callback, params) }
function getCarousel(data, callback, params){ return $_request('/backend/carousels/getCarousel', data, callback, params) }
function getCarouselList(data, callback, params){ return $_request('/backend/carousels/getList', data, callback, params) }
function addCarousel(data, callback, params){ return $_request('/backend/carousels/addCarousel', data, callback, params) }
function delCarousel(data, callback, params){ return $_request('/backend/carousels/delCarousel', data, callback, params) }
function editCarouselSort(data, callback, params){ return $_request('/backend/carousels/editCarouselSort', data, callback, params) }
function editCarouselActive(data, callback, params){ return $_request('/backend/carousels/editCarouselActive', data, callback, params) }

//活动管理
function getActivityList(data, callback, params) { return $_request('/backend/activities/getlist', data, callback, params) }//活动管理列表
function getActivityGroupByCategory(data, callback, params) { return $_request('/backend/activities/groupbycategory', data, callback, params) }//活动分类列表
function addActivity(data, callback, params) { return $_request('/backend/activities/add', data, callback, params) }//创建活动
function delActivity(data, callback, params) { return $_request('/backend/activities/delete', data, callback, params) }//删除活动
function addProject(data, callback, params) { return $_request('/backend/activities/projects/add', data, callback, params) } //创建活动项目
function updateActivityStatus(data, callback, params) { return $_request('/backend/activities/setstatus', data, callback, params) } //更改活动状态
function updateUploadStatus(data, callback, params) { return $_request('/backend/activities/setUploadstatus', data, callback, params) } //作品上传截止时间修改
function getActivity(data, callback, params) { return $_request('/backend/activities/getactivityone', data, callback, params) }//活动详情
function getActivityDetail(data, callback, params) { return $_request('/backend/activities/getactivity', data, callback, params) }//活动详情
function getActivityAndProject(data, callback, params) { return $_request('/backend/activities/getActivityAndProject', data, callback, params) }//活动详情
function getProjectAndFlow(data, callback, params) { return $_request('/backend/activities/getProjectAndFlow', data, callback, params) }//活动项目详情
function getActivityAndFlow(data, callback, params) { return $_request('/backend/activities/getActivityAndFlow', data, callback, params) }//活动阶段详情

//活动项目管理
function getProjectList(data, callback, params) { return $_request('/backend/activities/projects/getlist', data, callback, params) }//活动项目管理列表
function getProject(data, callback, params) { return $_request('/backend/activities/projects/getproject', data, callback, params) }//活动项目
function delProject(data, callback, params) { return $_request('/backend/activities/projects/delete', data, callback, params) }//删除活动项目
function updateProjectUploadStatus(data, callback, params) { return $_request('/backend/activities/projects/setUploadstatus', data, callback, params) }//作品上传截止时间修改

//活动阶段
function getFlowList(data, callback, params) { return $_request('/backend/activities/flows/getlist', data, callback, params) }//活动阶段管理列表
function addFlow(data, callback, params) { return $_request('/backend/activities/flows/add', data, callback, params) }//创建活动阶段
function getFlow(data, callback, params) { return $_request('/backend/activities/flows/getFlow', data, callback, params) }//活动阶段详情
function editFlow(data, callback, params) { return $_request('/backend/activities/flows/editFlow', data, callback, params) }//编辑活动阶段
function delFlow(data, callback, params) { return $_request('/backend/activities/flows/delete', data, callback, params) }//删除活动阶段
function editFlowSort(data, callback, params) { return $_request('/backend/activities/flows/editFlowSort', data, callback, params) }//编辑活动阶段排序
function updateFlowUploadStatus(data, callback, params) { return $_request('/backend/activities/flows/setUploadstatus', data, callback, params) }//作品上传截止时间修改

//通讯文稿
function getActivityNoticeList(data, callback, params) { return $_request('/backend/notices/getList', data, callback, params) }//通讯稿子列表
function addActivityNotice(data, callback, params) { return $_request('/backend/notices/addNotice', data, callback, params) }//创建通讯稿
function getActivityNotice(data, callback, params) { return $_request('/backend/notices/getNotice', data, callback, params) }//通讯稿子详情
function editActivityNotice(data, callback, params) { return $_request('/backend/notices/editNotice', data, callback, params) }//编辑通讯稿
function delActivityNotice(data, callback, params) { return $_request('/backend/notices/deleteNotice', data, callback, params) }//删除通讯稿
function getActivitiesIng(data, callback, params) { return $_request('/backend/notices/getActivitiesIng', data, callback, params) }//获取进行中的活动

//统计
function getCountData(data, callback, params) { return $_request('/backend/count/getActivityCategoryData', data, callback, params) }//活动数据统计
function getActivityData(data, callback, params) { return $_request('/backend/count/getActivityData', data, callback, params) }//活动统计
function getLastFiveYearsData(data, callback, params) { return $_request('/backend/count/getLastFiveYearsData', data, callback, params) }//获取最近5年
function getAwardData(data, callback, params) { return $_request('/backend/count/getAwardData', data, callback, params) }//活动奖项统计
function exportExcelData(data, callback, params) { return $_request('/backend/count/exportExcel', data, callback, params) }//活动奖项统计

//活动初审
function getFirstCheckList(data, callback, params) { return $_request('/backend/activities/firstchecks/getactivitylist', data, callback, params) }//活动管理列表
function getActivityContent(data, callback, params) { return $_request('/backend/activities/firstchecks/getactivitycontent', data, callback, params) }//活动内容
function postCheck(data, callback, params) { return $_request('/backend/activities/firstchecks/postcheck', data, callback, params) }//审核
//活动终审
function getFinalCheckList(data, callback, params) { return $_request('/backend/activities/finalchecks/getactivitylist', data, callback, params) }//活动管理列表

//团队报名
function getEnrollsActivityList(data, callback, params) { return $_request('/backend/activities/enrolls/getactivitylist', data, callback, params) }//活动列表
function getActivityAndProjects(data, callback, params) { return $_request('/backend/activities/enrolls/getactivityandprojects', data, callback, params) }//活动与项目
function getParticipantList(data, callback, params) { return $_request('/backend/activities/enrolls/getparticipantlist', data, callback, params) }//参与活动的学生列表
function deleteParticipant(data, callback, params) { return $_request('/backend/activities/enrolls/deleteparticipant', data, callback, params) }//删除报名团队
function getTeamMembers(data, callback, params) { return $_request('/backend/activities/enrolls/getTeamMembers', data, callback, params) }//获取团队成员
function editMember(data, callback, params) { return $_request('/backend/activities/enrolls/editMember', data, callback, params) }//编辑参与者
function getAttachList(data, callback, params) { return $_request('/backend/activities/enrolls/getAttachList', data, callback, params) }//获取附件列表

//专家分组
function getActivityExpertList(data, callback, params) { return $_request('/backend/activities/specialists/getactivityexpertlist', data, callback, params) }//专家活动分组
function getExpertProjectList(data, callback, params) { return $_request('/backend/activities/specialists/getExpertProjectList', data, callback, params) }//活动下所有的项目
function getExpertProjectsWithFlow(data, callback, params) { return $_request('/backend/activities/specialists/getExpertProjectsWithFlow', data, callback, params) }//活动下所有的项目
function getExpertFlowList(data, callback, params) { return $_request('/backend/activities/specialists/getExpertFlowList', data, callback, params) }//活动下所有的阶段
function getActivityExperts(data, callback, params) { return $_request('/backend/activities/specialists/getactivityexperts', data, callback, params) }//活动下所有专家
function setExperts(data, callback, params) { return $_request('/backend/activities/specialists/setexperts', data, callback, params) }//指派活动专家
function ActivityExpertsExperts(data, callback, params) { return $_request('/backend/activities/specialists/export', data, callback, params) }//指派活动专家

//成绩录入
function getScoresActivityList(data, callback, params) { return $_request('/backend/activities/logscores/getactivitylist', data, callback, params) }//活动列表
function getScoresProjectList(data, callback, params) { return $_request('/backend/activities/logscores/getprojectlist', data, callback, params) }//活动项目列表
function getScoreActivityContent(data, callback, params) { return $_request('/backend/activities/logscores/getScoreActivityContent', data, callback, params) }//活动包含项目和阶段
function getScoreParticipantList(data, callback, params) { return $_request('/backend/activities/logscores/getScoreParticipantList', data, callback, params) }//线下活动参与者列表
function createScoreExcelTemple(data, callback, params) { return $_request('/backend/activities/logscores/createscoreexceltemple', data, callback, params) }//创建模板文件
function saveScores(data, callback, params) { return $_request('/backend/activities/logscores/savescores', data, callback, params) }//提交分数

//成绩汇总
function getResultActivityList(data, callback, params) { return $_request('/backend/activities/results/getactivitylist', data, callback, params) }//活动列表
function getResultActivityDetail(data, callback, params) { return $_request('/backend/activities/results/getactivity', data, callback, params) }//活动列表
function getResultProjectList(data, callback, params) { return $_request('/backend/activities/results/getprojectlist', data, callback, params) }//活动项目列表
function showAward(data, callback, params) { return $_request('/backend/activities/results/showAward', data, callback, params) }//查看奖项
function previewAward(data, callback, params) { return $_request('/backend/activities/results/previewAward', data, callback, params) }//预览奖项
function createAward(data, callback, params) { return $_request('/backend/activities/results/createAward', data, callback, params) }//生成奖项
function reportAward(data, callback, params) { return $_request('/backend/activities/results/reportAward', data, callback, params) }//奖项上报
function getAwardNames(data, callback, params) { return $_request('/backend/activities/results/getAwardNames', data, callback, params) }//获取奖项名称
function editResultAward(data, callback, params) { return $_request('/backend/activities/results/editResultAward', data, callback, params) }//修改奖项名称
function editResultAward2(data, callback, params) { return $_request('/backend/activities/results/editResultAward2', data, callback, params) }//修改奖项名称
function exportAwardExcel(data, callback, params) { return $_request('/backend/activities/results/exportAwardExcel', data, callback, params) }//导出学生奖项
function showScoreDetail(data, callback, params) { return $_request('/backend/activities/results/showScoreDetail', data, callback, params) }//查看分数明细
function getScoreDetail(data, callback, params) { return $_request('/backend/activities/results/getScoreDetail', data, callback, params) }//参与者评分明细
function getAwardList(data, callback, params) { return $_request('/backend/activities/results/getAwardList', data, callback, params) }//统计每一项获奖人数

//数据字典
function getAllDic(data, callback, params){ return $_request('/backend/systems/dics/getAllDic', data, callback, params) }//获取所有字典
function getDicItemList(data, callback, params){ return $_request('/backend/systems/dics/getdicitemlist', data, callback, params) }//字典数据定义项列表
function addDicItem(data, callback, params){ return $_request('/backend/systems/dics/adddicitem', data, callback, params) }//字典数据新增定义项
function delDicItem(data, callback, params){ return $_request('/backend/systems/dics/deldicitem', data, callback, params) }//字典数据删除定义项
function editDicItem(data, callback, params){ return $_request('/backend/systems/dics/editdicitem', data, callback, params) }//字典数据编辑定义项
function getDicItemsByName(data, callback, params){ return $_request('/backend/systems/dics/getdicnamebyname', data, callback, params) }//字典数据


//专家管理
function regSmsCode(data, callback, params){ return $_request('/experts/register/regSmsCode', data, callback, params) }//专家注册验证码
function loginSmsCode(data, callback, params){ return $_request('/experts/login/loginSmsCode', data, callback, params) }//专家登录验证码
function expertLogin(data, callback, params){ return $_request('/experts/login/submit', data, callback, params) }//专家登录
function submitReg(data, callback, params){ return $_request('/experts/register/submit', data, callback, params) }//专家提交注册
function getProtitles(data, callback, params){ return $_request('/experts/register/getProtitles', data, callback, params) }//获取职称类型字典
function getExpertList(data, callback, params){ return $_request('/backend/systems/experts/list', data, callback, params) }//专家列表
function countExperts(data, callback, params){ return $_request('/backend/systems/experts/countExperts', data, callback, params) }//获取专家数量
function resetInviteLink(data, callback, params){ return $_request('/backend/systems/experts/resetLink', data, callback, params) }//重新生成邀请连接
function sendInviteSms(data, callback, params){ return $_request('/backend/systems/experts/sendInviteSms', data, callback, params) }//发送邀请短信
function editExpert(data, callback, params){ return $_request('/backend/systems/experts/edit', data, callback, params) }//编辑专家
function deleteExpert(data, callback, params){ return $_request('/backend/systems/experts/delete', data, callback, params) }//删除专家
function exportExperts(data, callback, params){ return $_request('/backend/systems/experts/export', data, callback, params) }//导出专家
function auditExperts(data, callback, params){ return $_request('/backend/systems/experts/audit', data, callback, params) }//批量审核专家

//学生管理
function getStudentList(data, callback, params){ return $_request('/backend/systems/students/list', data, callback, params) }//学生列表
function editStudent(data, callback, params){ return $_request('/backend/systems/students/edit', data, callback, params) }//编辑学生
function deleteStudent(data, callback, params){ return $_request('/backend/systems/students/delete', data, callback, params) }//删除学生

//作品信息
function getPdActivityList(data, callback, params){ return $_request('/backend/activities/products/getActivityList', data, callback, params) }//活动列表
function getPdActivityTypes(data, callback, params){ return $_request('/backend/activities/products/getActivityTypes', data, callback, params) }//活动类型列表
function getPdActivityDetail(data, callback, params){ return $_request('/backend/activities/products/getActivityDetail', data, callback, params) }//活动详情
function getPdParticipantList(data, callback, params){ return $_request('/backend/activities/products/getParticipantList', data, callback, params) }//参与者列表
function getPdScoreParticipantList(data, callback, params){ return $_request('/backend/activities/products/getPdScoreParticipantList', data, callback, params) }//参与者作品分数列表
function getEntryList(data, callback, params){ return $_request('/backend/activities/products/getEntryList', data, callback, params) }//作品文件列表
function doPdAudit(data, callback, params){ return $_request('/backend/activities/products/doAudit', data, callback, params) }//审核作品
function exportProducts(data, callback, params){ return $_request('/exportProducts', data, callback, params) }//导出作品
function getProductDetail(data, callback, params){ return $_request('/backend/activities/products/getProductDetail', data, callback, params) }//作品列表
function returnBackAudit(data, callback, params){ return $_request('/backend/activities/products/returnBackAudit', data, callback, params) }//撤销作品审核
function doEnterNext(data, callback, params){ return $_request('/backend/activities/products/doEnterNext', data, callback, params) }//入围
function cancelEnterNext(data, callback, params){ return $_request('/backend/activities/products/cancelEnterNext', data, callback, params) }//取消入围
function publishEnter(data, callback, params){ return $_request('/backend/activities/products/publishEnter', data, callback, params) }//发布入围名单

//专家线上评审
function getOlActivityList(data, callback, params){ return $_request('/experts/getActivityList', data, callback, params) }//活动列表
function getOlActivityDetail(data, callback, params){ return $_request('/experts/getActivityDetail', data, callback, params) }//活动详情
function getOlParticipantDetail(data, callback, params){ return $_request('/experts/getOlParticipantDetail', data, callback, params) }//参与者作品
function getOlProductDetail(data, callback, params){ return $_request('/experts/getOlProductDetail', data, callback, params) }//参与者作品
function getOlParticipantList(data, callback, params){ return $_request('/experts/getParticipantList', data, callback, params) }//参与者列表
function doOlScore(data, callback, params){ return $_request('/experts/doScore', data, callback, params) }//打分

//作品信息
function getMbActivityList(data, callback, params){ return $_request('/backend/activities/members/getActivityList', data, callback, params) }//活动列表
function getMbActivityTypes(data, callback, params){ return $_request('/backend/activities/members/getActivityTypes', data, callback, params) }//活动类型列表
function getMbActivityDetail(data, callback, params){ return $_request('/backend/activities/members/getActivityDetail', data, callback, params) }//活动详情
function getMemberList(data, callback, params){ return $_request('/backend/activities/members/getMemberList', data, callback, params) }//学员列表
function exportMembers(data, callback, params){ return $_request('/backend/activities/members/exportMembers', data, callback, params) }//学员导出
function cancelApply(data, callback, params){ return $_request('/backend/activities/members/cancelApply', data, callback, params) }//取消报名
function batchCancelApply(data, callback, params){ return $_request('/backend/activities/members/batchCancelApply', data, callback, params) }//批量取消报名

//创建拓展信息
function addProblem(data, callback, params){ return $_request('/backend/activities/questionnaires/addProblem', data, callback, params) }//新增拓展信息(问卷内容)
function addQuestionnaires(data, callback, params){ return $_request('/backend/activities/questionnaires/addQuestionnaires', data, callback, params) }//新增拓展信息(问卷)
function getQuestionAndProblems(data, callback, params){ return $_request('/backend/activities/questionnaires/getQuestionAndProblems', data, callback, params) }//获取拓展信息(问卷)
function getProblem(data, callback, params){ return $_request('/backend/activities/questionnaires/getProblem', data, callback, params) }//获取拓展信息(问卷内容)
function delProblem(data, callback, params){ return $_request('/backend/activities/questionnaires/delProblem', data, callback, params) }//删除问卷内容

//活动档案
function getArchiveActivityList(data, callback, params){ return $_request('/backend/activities/archive/getArchiveActivityList', data, callback, params) }//活动档案列表
function getArchiveActivityContent(data, callback, params){ return $_request('/backend/activities/archive/getArchiveActivityContent', data, callback, params) }//活动档案列表
function getActivityParticipantList(data, callback, params){ return $_request('/backend/activities/archive/getActivityParticipantList', data, callback, params) }//活动档案列表
function getParticipantInfo(data, callback, params){ return $_request('/backend/activities/archive/getParticipantInfo', data, callback, params) }//活动档案学生基本信息
function getArchiveActivity(data, callback, params){ return $_request('/backend/activities/archive/getArchiveActivity', data, callback, params) }//活动档案活动
function studentToPdf(data, callback, params){ return $_request('/backend/activities/archive/studentToPdf', data, callback, params) }//导出参加活动的学生信息
function getActivityParticipants(data, callback, params){ return $_request('/backend/activities/archive/getActivityParticipants', data, callback, params) }//导出参加活动的学生信息
function getStudentSchool(data, callback, params){ return $_request('/backend/activities/archive/getStudentSchool', data, callback, params) }//导出参加活动的学生信息
function exportArchiveExcel(data, callback, params){ return $_request('/backend/activities/archive/exportExcel', data, callback, params) }//导出参加活动的学生信息

//PC学生端
function studentLoginSmsCode(data, callback, params){ return $_request('/student/login/loginSmsCode', data, callback, params) }//登录验证码
function studentLogin(data, callback, params){ return $_request('/student/login/submit', data, callback, params) }//登录
